package leecode

import "fmt"

func WiggleMaxLength(nums []int) (result int) {
	sub := 0
	temp := 0
	for i := 0; i+1 < len(nums); i++ {
		sub = nums[i+1] - nums[i] //计算当前两个元素的差值
		if (temp <= 0 && sub > 0) || (temp >= 0 && sub < 0) {
			temp = sub
			fmt.Println(temp)
			result++
		}
	}
	return result
}
